var gulp=require("gulp");
var webserver=require("gulp-webserver"),
    sass=require('gulp-ruby-sass'),
    livereload=require("gulp-livereload")

gulp.task("webserver",function(){
    gulp.src("dist")
        .pipe(webserver({
            livereload:true,
            open:true
        }))
})
gulp.task("sass",function(){
    return sass('src/sass/*.scss',{style:"compact"})
        .on("error",function(err){
            console.log("编译错误，err.message")
        })
        .pipe(gulp.dest('dist/css'));
})
gulp.task("html",function(){
    return gulp.src("src/**/*.html")
        .pipe(gulp.dest("dist"))
})
gulp.task("watch",function(){
    gulp.watch("src/**/*.html",["html"]);
    gulp.watch("src/sass/*.scss",["sass"]);
})
gulp.task("default",["webserver","sass","html","watch"]);
